package main

import (
	"fmt"
	"math/rand"
	"time"
)

/**
 * @author: guangcheng
 * @date:   2020/11/13 16:06
 * @version  V1.0
 * @description:
 *
 */
func main() {

	var myCharArr [26]byte
	for i := 0; i < 26; i++ {
		//利用字母+i, 求出所有字母
		myCharArr[i] = 'A' + byte(i)
	}

	for i := 0; i < 26; i++ {
		fmt.Printf("%c", myCharArr[i])

	}

	var scoreArr = [...]int{69, 100, 67, 89, 99, 81, 65}
	max := scoreArr[0]
	index := 0
	for i := range scoreArr {
		if scoreArr[i] > max {
			max = scoreArr[i]
			index = i
		}
	}

	fmt.Println("\n", index, max)

	arr1 := [...]int{69, 100, 67, 89, 99, 81, 65}
	sum := 0
	for i := range arr1 {
		sum += arr1[i]
	}
	fmt.Println("avg=", float64(sum)/float64(len(arr1)))

	//随机数下个种子, 生成一个数组
	var arr2 [5]int
	rand.Seed(time.Now().UnixNano())
	for i := range arr2 {
		arr2[i] = rand.Intn(1000)
	}
	fmt.Println(arr2)

	//翻转数组
	l := len(arr2)
	for i := 0; i < l/2; i++ {

		temp := arr2[l-1-i]
		arr2[l-1-i] = arr2[i]
		arr2[i] = temp
	}
	fmt.Println(arr2)

}
